package com.situ.mall.web.controller;

import com.situ.mall.common.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

//主页
@Controller
@RequestMapping("/")
public class IndexController {

    @Autowired
    private IProductService productService;

    @GetMapping("/")
    public String index(Model model){
         model.addAttribute("products",productService.indexProducts(1));
        //return字符串就是转发到页面
        return "index";
    }
}
